<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    </head>
    <body>


        请选择:
        <select id="signType">

            <option value="MD5">MD5</option>
            <option value="RSA">rsa</option>
        </select>

        <input type="button" name="flightnum" id="flightnum" value="click me" />

        <select name="policyid" id="policyid"></select>


        <script>
            var data = [{
                    name: "sky",
                    id: 1
                },
                {
                    name: "kia",
                    id: 2
                }
            ];
            $("#flightnum").click(function() {

                $('#policyid').get(0).options.length = 0;
                $('#policyid').append('<option value="">请选择</option>');
                $.each(data, function(i, obj) {
                    var option = $('<option />');
                    option.val(obj.id);
                    option.text(obj.name);

                    $('#policyid').append(option);
                });

            });


            $("#signType option[value='RSA']").prop("selected", true);
            console.log();
            console.log();
            //  $("#signType option[value='rsa']").attr("selected", true); 
            console.log("woc");
        </script>







    </body>
</html>
